Check if we have dbatools docker images


In [ ]:
docker images "dbatools/*"

Verify if we have containers setup


In [ ]:
docker ps -a

If containers are not up and running, start them


In [ ]:
# start container dockersql1
docker start dockersql1

# start container dockersql2 
docker start dockersql2

Test connection to the instances

Now that containers are up and running, we can use Test-DbaConnection to confirm they are accessible


In [ ]:
$dbatools1 = "localhost,1433"
$dbatools2 = "localhost,14333"
$secureString = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $secureString

# Confirm connection
Test-DbaConnection -SqlInstance $dbatools1, $dbatools2 -SqlCredential $cred | Format-Table

In [ ]:
# Confirm that you can connect to the instances and see the databases
Get-DbaDatabase -SqlInstance $dbatools1,$dbatools2 -SqlCredential $cred | Format-Table